<include file="public@header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
	
			<li class="active" id="list"><a href="{:url('customer/index')}">客户</a></li>
			<li><a href="{:url('customer/addCustomer')}">添加</a></li>
			<!-- 	<li><a href="{:url('user/add')}">{:lang('ADMIN_USER_ADD')}</a></li> -->
		</ul>
		<form class="well form-inline margin-top-20" method="post" action="{:url('customer/index')}">
			
			公司名称:
			<input type="text" class="form-control" name="customer_name" style="width: 120px;" value="{$customer_name}" placeholder="请输入公司名称">
			孵化器名称:
			<input type="text" class="form-control" name="inucbator_name" style="width: 120px;" value="{$incubator_name}" placeholder="请输入孵化器名">
			业务员名称:
			<input type="text" class="form-control" name="linkman" style="width: 150px;" value="{$salesman}" placeholder="请输入业务员名称">
			时间:
			<input type="text" class="form-control js-bootstrap-date" name="start_time"
			value="{$stime|default=''}"
			style="width: 140px;" autocomplete="off">-
			<input type="text" class="form-control js-bootstrap-date" name="end_time"
			value="{$etime|default=''}"
			style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;<br/><br/>
			客户性质：	
			<select class="form-control" name="customer_type" style="width: 140px;">
				<option value='0' <if condition="$customer_type eq 0">selected</if>>全部</option>
				<option value="1" <if condition="$customer_type eq 1">selected</if>>项目客户</option>
				<option value="2" <if condition="$customer_type eq 2">selected</if>>合作客户</option>
			
			</select> &nbsp;&nbsp;
			跟进阶段：	
			<select class="form-control" name="follow_stage" style="width: 140px;">
				<option value='0' <if condition="$follow_stage eq 0">selected</if>>全部</option>
				<option value="1" <if condition="$follow_stage eq 1">selected</if>>未跟进</option>
				<option value="2" <if condition="$follow_stage eq 2">selected</if>>初步洽谈</option>
				<option value="3" <if condition="$follow_stage eq 3">selected</if>>需求确认</option>
				<option value="4" <if condition="$follow_stage eq 4">selected</if>>意向确认</option>
				<option value="5" <if condition="$follow_stage eq 5">selected</if>>入孵签订</option>
				<option value="6" <if condition="$follow_stage eq 6">selected</if>>客户流失</option>
			
			</select> &nbsp;&nbsp;


			<input type="submit" class="btn btn-primary" value="搜索" />
			<a class="btn btn-danger" href="{:url('Customer/index')}">清空</a>
		</form>
		<table class="table table-hover table-bordered">
			<thead>
				<tr>
					<th width="50">ID</th>
					<th>公司名称</th>
					<th>所属孵化器</th>
					<th>客户性质</th>
					<!-- <th>业务员</th> -->
					<th>职位</th>
					<th>来源</th>
					<th>领域</th>
					<th>阶段</th>
					<th>跟进阶段</th>
					
					<th>客户电话</th>
					<th>业务员</th>
					<th>业务员电话</th>
					<th>添加时间</th>
					<th width="130">操作</th>
				</tr>
			</thead>
			<tbody>
				<!-- 	<php>$user_statuses=array("0"=>lang('USER_STATUS_BLOCKED'),"1"=>lang('USER_STATUS_ACTIVATED'),"2"=>lang('USER_STATUS_UNVERIFIED'));</php> -->
				
				<foreach name="list" item="vo">
					<tr>
					    <input type="hidden" name="id" value="">
						<td>{$vo.id}</td>
						<td><a class="btn " href='{:url('Customer/detailCustomer',array('id'=>$vo.id))}'>{$vo.customer_name}</a></td>
						<td><?php echo get_incubator_name($vo['incubator_id']); ?></td>
						<td><if condition="$vo['customer_type'] eq 1">项目客户<else/>合作客户</if></td>
						<!-- <td>{$vo.salesman}</if></td> -->
						<td>{$vo.position}</td>
						<td>
							<!-- <switch name="vo.other_link">
								<case value="0">暂无</case>	
								<case value="1">电话</case>
								<case value="2">来访</case>
								<case value="3">熟人介绍</case>
								<case value="4">其他</case>
								


							</switch> -->
							<?php echo get_cate_name(11,$vo['other_link']); ?>

						</td>
						<td><?php echo get_cate_name(6,$vo['field']); ?></td>
						<td><!-- <switch name="vo.stage">
							<case value="11000"> 暂无</case>	

							<case value="0"> 未跟进</case>
							<case value="1"> 初步洽谈</case>
							<case value="2"> 需求确认</case>
							<case value="3"> 意向确认</case>
							<case value="4"> 入孵签订</case>
							<case value="5"> 客户流失</case>






						</switch> -->
							
							<?php echo get_cate_name(10,$vo['stage']); ?>


						</td>
						<td><?php echo get_cate_name(15,$vo['follow_stage']); ?></td>

						<td>{$vo.mobile}</td>
						<!-- 	<td><?php echo get_user_name($vo['salesman']); ?></td> -->
						<td>{$vo.salesman}</td>
						<td>{$vo.salesmobile}</td>
						<td>{$vo.create_time}</td>
						
						<td>
							<a class='edit' href='{:url('Customer/editCustomer',array('id'=>$vo.id))}'>编辑</a>
							|
							<a class='del' id="{$vo.id}">删除</a>
							|
							<if condition="$vo.is_free eq 1">
							<a class='free' id="{$vo.id}">预约免费</a>
							<else/>
							 <a class='cancel_free' id="{$vo.id}" style="color: gray">取消免费</a>
							</if>
						</td>


					</tr>
				</foreach>
			</tbody>
		</table>
		<div class="pagination">{$page}</div>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
</body>
</html>
<script>
	$(function(){

	})
	$(".del").click(
	    function(){
	    if(confirm("确认要删除吗")){
	    	    var id=$(this).attr("id");
	    	    $.post("{:url('delCustomer')}",
	    		{id:id},
	    		function(data,status){

	    			location.href="{:url('index')}";
	    		});
	    }
		
		
	    }
	);
	$(".free").click(
	    function(){
	    if(confirm("确认该客户预约会议室免费吗？")){
	    	    var id=$(this).attr("id");
	    	    $.post("{:url('freeCustomer')}",
	    		{id:id},
	    		function(data,status){

	    			location.href="{:url('index')}";
	    		});
	    }
		
		
	    }
	);
	$(".cancel_free").click(
	    function(){
	    if(confirm("确认该客户预约会议室取消免费吗？")){
	    	    var id=$(this).attr("id");
	    	    $.post("{:url('freeCustomer')}",
	    		{id:id,cancel:1},
	    		function(data,status){

	    			location.href="{:url('index')}";
	    		});
	    }
		
		
	    }
	);


</script>